﻿// Imports
using System.Collections.Generic;

namespace Nickel
{

    /// <summary>
    /// Search result
    /// </summary>
    public class SearchResult
    {

        /// <summary>
        /// Creates search result instance
        /// </summary>
        public SearchResult(Blog blog, Article article)
        {

            // Initialize result data
            Author = blog.GetAuthorById(article.Author).Name;
            Count = 0;
            ID = article.ID;
            ModifiedDateTime = article.ModifiedDateTime;
            SubTitle = article.SubTitle;
            Tags = article.Tags;
            Text = StringHelper.RemoveHtml(Markup.Parse(article.Text));
            Title = article.Title;
            Url = StringHelper.Encode(Title);

        }

        /// <summary>
        /// Author's GUID
        /// </summary>
        public string Author;

        /// <summary>
        /// Number of results in this search
        /// </summary>
        public int Count;

        /// <summary>
        /// Creation date time
        /// </summary>
        public string CreationDateTime;

        /// <summary>
        /// Article ID
        /// </summary>
        public string ID;

        /// <summary>
        /// Last modified date time
        /// </summary>
        public string ModifiedDateTime;

        /// <summary>
        /// Article sub title
        /// </summary>
        public string SubTitle;

        /// <summary>
        /// List of category tags
        /// </summary>
        public List<string> Tags;

        /// <summary>
        /// Article content
        /// </summary>
        public string Text;

        /// <summary>
        /// Title of article
        /// </summary>
        public string Title;

        /// <summary>
        /// Encoded title
        /// </summary>
        public string Url;

    }

}
